package org.xurui.bsj.protocol.command.impl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.xurui.bsj.protocol.msg.BsjMessage;

import java.math.BigDecimal;

public class testDemo {
    public static void main(String[] args) {
       /* String tempBody="1!AC:BC:32:78:A2:5F!-97@0@3";
        String[] tempBodyArr = tempBody.split("@");
        System.out.println(tempBodyArr.length);
        System.out.println(tempBodyArr[2]);*/
        /*String time="15";
        BigDecimal decimal=new BigDecimal(time);
        BigDecimal fen=new BigDecimal("60");
       BigDecimal min= decimal.divide(fen).setScale(2,BigDecimal.ROUND_HALF_UP);

        System.out.println(min);
        String mMin="";
        if (min.compareTo(BigDecimal.TEN) == -1) {
            System.out.println("小于0");
            mMin = "0" + min;
        }else {
            mMin = String.valueOf(min);
        }
        System.out.println("mMin:"+mMin);*/

        /*// 如果分钟数没超过10就在他前面加个0
        String mMin="";
        if (min < 10) {
            mMin = "0" + min;
        } else {
            mMin = String.valueOf(min);
        }
        // 打印最终的结果
        System.out.println("mMin:mSec = " + mMin);*/

       /* String batStr="80%";
        int aa=Integer.parseInt(batStr.replace("%",""));
        System.out.println(aa);*/
        /*String aa="1E0.000000N0.000000T00000000000000";
        System.out.println(aa.substring(2,10));
        System.out.println(aa.substring(10,11));
        System.out.println(aa.substring(11,19));
        System.out.println(aa.substring(19,20));

        System.out.println(aa.substring(20,24));
        System.out.println(aa.substring(24,26));
        System.out.println(aa.substring(26,28));
        System.out.println(aa.substring(28,30));
        System.out.println(aa.substring(30,32));
        System.out.println(aa.substring(32,34));*/
        /*String[] lbsArr="460!0!10550!245976521!-66".split("!");
        System.out.println("MCC:"+lbsArr[0]);
        System.out.println("MNC:"+lbsArr[1]);
        System.out.println("LAC:"+lbsArr[2]);
        System.out.println("CID:"+lbsArr[3]);
        System.out.println("RXLEV:"+lbsArr[4]);
        //String[] lbsArr = data.get("LBS").toString().split("!");
        JSONObject json = new JSONObject();
        json.put("mcc",lbsArr[0]);
        json.put("mnc",lbsArr[1]);
        json.put("lac",lbsArr[2]);
        json.put("cellid",lbsArr[3]);
        json.put("signal",lbsArr[4]);
        System.out.println(json.toString());

        JSONArray jsonArr=new JSONArray();
        jsonArr.add(json);
        System.out.println(jsonArr.toJSONString());*/

      /*  String json= "{\"headers\":{\"productId\":\"sxl-21A\",\"_uid\":\"1530094984483348480\",\"deviceName\":\"869727050307964\"},\"code\":\"WIFIMAC\",\"messageType\":\"REPORT_PROPERTY\",\"messageId\":\"869727050307964_155415\",\"deviceId\":\"869727050307964\",\"properties\":{\"sv\":0,\"bat\":40,\"upday\":\"270522\",\"trackerstatus\":{\"cd\":1,\"wifi\":0,\"m1\":0,\"m2\":1,\"m3\":1,\"kq\":0,\"gps\":1,\"jz\":0,\"dw\":1,\"mdrszqk\":0,\"mdrkg\":0,\"mdr\":1,\"wl1\":0,\"wl1sz\":0},\"macinfo\":[{\"rssi\":\"-54\",\"mac\":\"48:0E:EC:C0:6D:32\"},{\"rssi\":\"-59\",\"mac\":\"FC:8F:7D:B2:89:CC\"},{\"rssi\":\"-74\",\"mac\":\"84:3E:92:B0:04:E4\"},{\"rssi\":\"-77\",\"mac\":\"04:95:E6:DB:AA:F8\"},{\"rssi\":\"-79\",\"mac\":\"6A:E9:B2:D0:05:16\"},{\"rssi\":\"-80\",\"mac\":\"98:97:CC:46:90:C4\"}],\"signal\":80,\"uptime\":\"155415\"},\"timestamp\":1653638046747}";
        JSONObject wifiMac= JSON.parseObject(json);


        String kaStr= "{\"headers\":{\"productId\":\"sxl-21A\",\"_uid\":\"1526471252963442688\",\"deviceName\":\"869727050307964\"},\"code\":\"KA\",\"messageType\":\"REPORT_PROPERTY\",\"messageId\":\"869727050307964_155441\",\"deviceId\":\"869727050307964\",\"properties\":{\"sv\":0,\"bat\":82,\"upday\":\"170522\",\"trackerstatus\":{\"cd\":1,\"wifi\":0,\"m1\":1,\"m2\":0,\"m3\":1,\"kq\":0,\"gps\":1,\"jz\":1,\"dw\":1,\"mdrszqk\":1,\"mdrkg\":0,\"mdr\":1,\"wl1\":1,\"wl1sz\":1},\"ka\":{\"mnc\":\"中国移动\",\"kainfo\":[{\"rxlev\":\"38\",\"cellid\":\"245976521\",\"lac\":\"10550\"}],\"mcc\":\"中国\",\"ta\":\"0\"},\"signal\":60},\"timestamp\":1652774081827}";
  */  }
}
